//
// Created by edward on 23-3-16.
//

#ifndef LEARNOPENGL_MODEL_H
#define LEARNOPENGL_MODEL_H

#include "Mesh.h"
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include <iostream>
#include <memory>

class Shader;

class Model {
public:
    explicit Model(const std::string &path);
    ~Model();
    void draw(Shader *shader);
    void showBorder();
    void hideBorder();
private:
    void traverse(aiNode *node, const aiScene *scene);
    Mesh createMesh(aiMesh *mesh, const aiScene *scene);
    std::vector<Texture> loadMaterialTextures(aiMaterial *mat, aiTextureType type,
                                         std::string typeName);
    void drawBorder(Shader *shader);

    std::vector<Mesh> meshes_;
    std::string directory_;
    bool showBorder_;
    std::unique_ptr<Shader> borderShader;
};


#endif //LEARNOPENGL_MODEL_H
